package com.qtcm.nas.jhx.bendianpinglun.web;

import com.qtcm.nas.cxm.yushouka.service.IYuShouService;
import com.qtcm.nas.jhx.bendianpinglun.pojo.Reservation_form;
import com.qtcm.nas.jhx.bendianpinglun.service.IYuyueservice;
import com.qtcm.nas.jhx.chongzhi.service.IYushouservice;
import com.qtcm.nas.jhx.dianpu.service.IDianpuservice;
import com.qtcm.nas.jhx.pingjia.service.IPinglunservice;
import com.qtcm.nas.jhx.yeji.service.impl.Yejiservice;
import com.qtcm.nas.jhx.yingyee.service.IYingyeeservice;
import com.qtcm.nas.jhx.yuangong.service.IYuangongservice;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

@Controller("yuyueController")
@RequestMapping("/admin/car/bosssystem")
public class YuyueController {
    @Resource(name = "yuyueservice")
    private IYuyueservice yuyueservice;
    @Resource(name = "yuangongservice")
    private IYuangongservice yuangongservice;
    @Resource(name = "pinglunservice")
    private IPinglunservice pinglunservice;
    @Resource(name = "yushouservice")
    private IYushouservice yushouservice;
    @Resource(name = "dianpuservice")
    private IDianpuservice dianpuservice;

    @RequestMapping("/findcount")
    public String findcount(HttpServletRequest request, Integer G_state, Model model, HttpSession session) {

        G_state = yuyueservice.findcount();//已洗数量
        session.setAttribute("G_state", G_state);
        return "redirect:findcount1";
    }

    @RequestMapping("/findcount1")
    public String findcount1(HttpServletRequest request, Integer G_state1, Model model, Reservation_form r, HttpSession session) {
        G_state1 = yuyueservice.findcount1();//排队车辆
        session.setAttribute("G_state1", G_state1);
        return "redirect:count";
    }

    @RequestMapping(value = "/count")
    public String count(Model model, HttpServletRequest request, Integer Z_state, HttpSession session) {
        Z_state = yuangongservice.count();
        model.addAttribute("Z_state", Z_state);
        session.setAttribute("Z_state", Z_state);
        return "redirect:countpingjia";
    }

    @RequestMapping(value = "/countpingjia")
    public String countpingjia(Model model, HttpSession session, Integer i, HttpServletRequest request) {
        i = pinglunservice.countpingjia();//评价数量
        model.addAttribute("i", i);
        session.setAttribute("i", i);
        return "redirect:counthpj";
    }

    @RequestMapping(value = "/counthpj")
    public String counthpj(Model model, HttpSession session, Integer i1, HttpServletRequest request) {
        i1 = pinglunservice.counthpj();
        model.addAttribute("i1", i1);
        session.setAttribute("i1", i1);
        return "redirect:countcpj";
    }

    @RequestMapping(value = "/countcpj")
    public String countcpj(Model model, HttpSession session, Integer i2, HttpServletRequest request) {
        List list=dianpuservice.dianpu();
        String dianming= (String) list.get(0);
        String dianming1= (String) list.get(1);
        model.addAttribute("dianming",dianming);
        model.addAttribute("dianming1",dianming1);
        i2 = pinglunservice.countcpj();
        model.addAttribute("i2", i2);
        session.setAttribute("i2", i2);
        return "today_data";
    }

    @RequestMapping(value = "liang")
    private String liang(Model model, HttpSession session, HttpServletRequest request) {
        List list = yuyueservice.liang();
        int i = (int) list.get(0);
        int i1 = (int) list.get(1);
        int i2 = (int) list.get(2);
        int i3 = (int) list.get(3);
        int i4 = (int) list.get(4);
        int i5 = (int) list.get(5);
        int i6 = (int) list.get(6);
        session.setAttribute("i", i);
        session.setAttribute("i1", i1);
        session.setAttribute("i2", i2);
        session.setAttribute("i3", i3);
        session.setAttribute("i4", i4);
        session.setAttribute("i5", i5);
        session.setAttribute("i6", i6);
        return "redirect:nliang";
    }

    @RequestMapping(value = "nliang")
    private String nliang(Model model, HttpSession session, HttpServletRequest request) {
        List list = yuyueservice.nliang();
        int x = (int) list.get(0);
        int x1 = (int) list.get(1);
        int x2 = (int) list.get(2);
        int x3 = (int) list.get(3);
        int x4 = (int) list.get(4);
        int x5 = (int) list.get(5);
        int x6 = (int) list.get(6);
        if (list.get(0) == null) {
            x = 0;
        }
        model.addAttribute("x", x);
        model.addAttribute("x1", x1);
        model.addAttribute("x2", x2);
        model.addAttribute("x3", x3);
        model.addAttribute("x4", x4);
        model.addAttribute("x5", x5);
        model.addAttribute("x6", x6);
        return "today_washcar";
    }

    @RequestMapping("/findcount2")
    public String findcount2(HttpServletRequest request, Integer G_state, Model model, HttpSession session) {

        Integer G_state1 = yuyueservice.findcount();//门店数据,今日实时数据的已洗数量
        model.addAttribute("G_state1", G_state1);
        session.setAttribute("G_state1", G_state1);
        return "redirect:countpj2";
    }

    @RequestMapping("/countpj2")
    public String countpj2(Model model, HttpSession session, String D_scorce, Integer i1) {
        i1 = pinglunservice.countpingjia();
        session.setAttribute("i1", i1);
        return "redirect:counthpj1";
    }

    @RequestMapping(value = "/counthpj1")
    public String counthpj1(Model model, HttpSession session, Integer i2, HttpServletRequest request) {
        i2 = pinglunservice.counthpj();
//        model.addAttribute("i2",i2);
        session.setAttribute("i2", i2);
        return "redirect:countcpj1";
    }

    @RequestMapping(value = "/countcpj1")
    public String countcpj1(Model model, HttpSession session, Integer i3, HttpServletRequest request) {
        i3 = pinglunservice.countcpj();
//        model.addAttribute("i3",i3);
        session.setAttribute("i3", i3);
        return "redirect:findcount3";
    }

    @RequestMapping("/findcount3")
    public String findcount3(HttpServletRequest request, Integer G_state2, Model model, Reservation_form r, HttpSession session) {
        G_state2 = yuyueservice.findcount1();//排队车辆
//        model.addAttribute("G_state2", G_state2);
        session.setAttribute("G_state2", G_state2);
        return "redirect:zongqian";
    }

  @RequestMapping("zongqian")
    public String zongqian(HttpServletRequest request,Integer zong,Model model,HttpSession session){
        int zongqian=yushouservice.zongqian();
//        model.addAttribute("zongqian",zongqian);
        session.setAttribute("zongqian",zongqian);
        return "redirect:jine1";
    }
    @Resource
    private IYingyeeservice yingyeeservice;
    @RequestMapping(value = "/jine1")
    public String jine1(Model model, Integer E_money, HttpSession session) {
        System.out.println("*****************");
        List list2 = yingyeeservice.jine();
        int i6 = (int) list2.get(6);
//        int huiyuanxiaofei2=i+i1+i2+i3+i4+i5+i6;

//        model.addAttribute("i6", i6);//当日会员消费
        session.setAttribute("i6",i6);//当日会员消费
//        return "redirect:chongqiann";
        return "redirect:dianpu";
    }
    @RequestMapping(value = "dianpu")
    private String dianpu(Model model, HttpSession session){
        List list=dianpuservice.dianpu();
        String dianming= (String) list.get(0);
        String dianming1= (String) list.get(1);
        model.addAttribute("dianming",dianming);
        model.addAttribute("dianming1",dianming1);
        return "today_storedata";
    }
}
